package problema008;

import java.io.BufferedReader;
import java.io.FileReader;

public class Largestmult5 {

	public static void main(String[] args){
		System.out.println(largestMultInFile5());
	}
	
	public static double largestMultInFile5(){
		int mayor = 0, act = 1;
		try{
			BufferedReader reader = new BufferedReader( new FileReader("numeroEj8.txt") );
			String linea = reader.readLine();	
			for(int i = 0; i < 996; i++){
				for(int j = i; j < i + 5; j++){
					act *= (int) linea.charAt(j) - 48; 
				}
				if(act > mayor) mayor = act;
				act = 1;
			}
			reader.close();
			}catch (Exception e){
				System.err.println("Error: " + e.getMessage());
		}	
		return mayor;
	}
	
	
}
